<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Saltstack," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="1.saltstack安装&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;准备两台机器 192.168.0.84  192.168.0.83 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;设置hostname &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#16">
<meta name="keywords" content="Saltstack">
<meta property="og:type" content="article">
<meta property="og:title" content="resin安装与配置">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/Saltstack/1. Saltstack 安装配置/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="1.saltstack安装&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;准备两台机器 192.168.0.84  192.168.0.83 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;设置hostname &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#16">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/01.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/02.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/03.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/04.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/05.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/06.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/07.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/08.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/09.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/10.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/11.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/12.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/13.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/14.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/15.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/16.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/17.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/18.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/19.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/20.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/21.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/22.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/23.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/24.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/25.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/26.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/27.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/28.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/29.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/30.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/31.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/32.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/33.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/34.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/35.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/36.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/37.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/38.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/39.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/40.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/41.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/42.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/43.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/44.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/45.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/46.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/47.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/48.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/49.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/50.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/51.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/52.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/53.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/54.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/55.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/56.png?raw=true">
<meta property="og:updated_time" content="2017-09-02T17:33:11.856Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="resin安装与配置">
<meta name="twitter:description" content="1.saltstack安装&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;准备两台机器 192.168.0.84  192.168.0.83 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;设置hostname &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#16">
<meta name="twitter:image" content="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/01.png?raw=true">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/Saltstack/1. Saltstack 安装配置/"/>





  <title>resin安装与配置 | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/Saltstack/1. Saltstack 安装配置/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">resin安装与配置</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T02:11:54+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="1-saltstack安装"><a href="#1-saltstack安装" class="headerlink" title="1.saltstack安装"></a>1.saltstack安装</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;准备两台机器 192.168.0.84  192.168.0.83</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;设置hostname</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /etc/sysconfig/network</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/01.png?raw=true" alt="01"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.83</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># vim /etc/sysconfig/network</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/02.png?raw=true" alt="02"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;配置hosts </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /etc/hosts</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/03.png?raw=true" alt="03"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.83</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># vim /etc/hosts</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/04.png?raw=true" alt="04"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;关闭selinux，清空iptables规则</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># yum install -y epel-release</span></div><div class="line">[root@web9 ~]<span class="comment"># yum install -y salt-master salt-minion</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.83：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># yum install -y epel-release</span></div><div class="line">[root@web10 ~]<span class="comment"># yum install -y salt-minion</span></div></pre></td></tr></table></figure>
<h3 id="启动服务"><a href="#启动服务" class="headerlink" title="启动服务"></a>启动服务</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84上：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件 /etc/salt/minion </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /etc/salt/minion</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;大概16行修改或增加    </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">master: 192.168.0.84</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/05.png?raw=true" alt="05"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;启动服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># service salt-master start</span></div><div class="line">Starting salt-master daemon: [确定]</div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># service salt-minion start</span></div><div class="line">Starting salt-minion daemon: [确定]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.83上：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件 /etc/salt/minion </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># vim /etc/salt/minion</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;大概16行修改或增加</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">master: 192.168.0.84</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/06.png?raw=true" alt="06"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;启动服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># service salt-minion start</span></div><div class="line">Starting salt-minion daemon: [确定]</div></pre></td></tr></table></figure>
<h3 id="配置认证"><a href="#配置认证" class="headerlink" title="配置认证"></a>配置认证</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;以下操作都是在192.168.0.84上：</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/07.png?raw=true" alt="07"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;现在要把 web10 加到 Accepted Keys</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt-key -a web10.yanyi.com</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/08.png?raw=true" alt="08"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;此时我们在client的 /etc/salt/pki/minion 目录下面会多出一个minion_master.pub 文件</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/09.png?raw=true" alt="09"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以使用 salt-key 命令查看到已经签名的客户端</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt-key 可以使用-A签名所有主机，也可以使用-d删除指定主机的key，-D删除所有主机。</p>
<h3 id="远程执行命令"><a href="#远程执行命令" class="headerlink" title="远程执行命令"></a>远程执行命令</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;示例1： salt ‘<em>‘ test.ping    这里的</em>表示所以已经签名的客户端，也可以指定其中一个，比如web10.yanyi.com</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/10.png?raw=true" alt="10"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;示例2:  salt ‘*’ cmd.run   ‘df -h’</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/11.png?raw=true" alt="11"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;说明： 这里的<em>必须是在master上已经被接受过的客户端，可以通过salt-key查到，通常是我们已经设定的id值。关于这部分内容，它支持通配、列表以及正则。 比如两台客户端  web10  web11， 那我们可以写成  salt ‘web</em>’    salt ‘web1[01]’   salt -L ‘web10,web11’   salt -E ‘web(10|11) 等形式，使用列表，即多个机器用 逗号分隔，而且需要加-L，使用正则必须要带-E选项&gt;。 它还支持grains，加-G选项，     pillar 加-I选项，下面会介绍到。</p>
<h2 id="2-saltstack-grains"><a href="#2-saltstack-grains" class="headerlink" title="2.saltstack grains"></a>2.saltstack grains</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;grains是在minion启动时收集到的一些信息，比如操作系统类型、网卡ip、内核版本、cpu架构等。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt ‘web10.yanyi.com’ grains.ls 列出所有的grains项目名字</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' grains.ls</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/12.png?raw=true" alt="12"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt ‘web10.yanyi.com’ grains.items 列出所有grains项目以及值</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' grains.items</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/13.png?raw=true" alt="13"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;grains的信息并不是动态的，并不会时时变更，它只是在minion启动时收集到的。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;我们可以根据grains收集到的一些信息，做配置管理工作。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;grains支持自定义信息。</p>
<h3 id="自定义-grains"><a href="#自定义-grains" class="headerlink" title="自定义 grains"></a>自定义 grains</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.83上，编辑文件 /etc/salt/grains </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># vim /etc/salt/grains</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">role: nginx</div><div class="line">env: <span class="built_in">test</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/14.png?raw=true" alt="14"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重启minion服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@web10 ~]<span class="comment"># service salt-minion restart</span></div><div class="line">Stopping salt-minion daemon:               [确定]</div><div class="line">Starting salt-minion daemon:               [确定]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84上：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;获取 grains：salt ‘*’ grains.item role env</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt '*' grains.item role env</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/15.png?raw=true" alt="15"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以借助grains的一些属性信息来执行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt -G role:nginx cmd.run 'hostname'</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/16.png?raw=true" alt="16"></p>
<h2 id="3-saltstack-pillar"><a href="#3-saltstack-pillar" class="headerlink" title="3.saltstack pillar"></a>3.saltstack pillar</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;pillar和grains不一样，是在master上定义的，并且是针对minion定义的一些信息。像一些比较重要的数据（密码）可以存在pillar里，还可以定义变量等。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;配置自定义pillar  /etc/salt/master</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /etc/salt/master</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;找到如下配置：</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/17.png?raw=true" alt="17"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;去掉前面的警号</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/18.png?raw=true" alt="18"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建此目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># mkdir /srv/pillar</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 /srv/pillar/test.sls </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/pillar/test.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;内容如下</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">conf: /etc/123.conf</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/19.png?raw=true" alt="19"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 /srv/pillar/top.sls  </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/pillar/top.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;内容如下</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">base:</div><div class="line">  <span class="string">'web10.yanyi.com'</span>:</div><div class="line">    - <span class="built_in">test</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/20.png?raw=true" alt="20"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重启master</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># service salt-master restart</span></div><div class="line">Stopping salt-master daemon: [确定]</div><div class="line">Starting salt-master daemon: [确定]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;当更改完pillar配置文件后，我们可以通过刷新pillar配置来获取新的pillar状态：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt ‘*’ saltutil.refresh_pillar</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/21.png?raw=true" alt="21"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;验证：salt  ‘*’ pillar.item conf</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/22.png?raw=true" alt="22"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;pillar同样可以用来作为salt的匹配对象。比如 salt  -I ‘conf:/etc/123.conf’  test.ping</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/23.png?raw=true" alt="23"></p>
<h2 id="4-配置管理安装-apache"><a href="#4-配置管理安装-apache" class="headerlink" title="4.配置管理安装 apache"></a>4.配置管理安装 apache</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.84上，编辑配置文件 /etc/salt/master</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /etc/salt/master</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;搜索找到 file_roots</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/24.png?raw=true" alt="24"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;打开如下内容的注释：</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/25.png?raw=true" alt="25"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建 /stv/salt 目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># mkdir /srv/salt</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 /srv/salt/top.sls </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;加入如下内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">base:</div><div class="line">  <span class="string">'*'</span>:</div><div class="line">    - apache</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/26.png?raw=true" alt="26"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;意思是，在所有的客户端上执行 apache模块</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重启 /etc/init.d/salt-master restart</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># service salt-master restart </span></div><div class="line">Stopping salt-master daemon: [确定]</div><div class="line">Starting salt-master daemon: [确定]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 /srv/salt/apache.sls </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/apache.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;加入如下内容，这个就是apache模块的内容</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这里如果只有一个服务，那么就可以写成 –name: httpd 不用再换一行了。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">apache-service:</div><div class="line">  pkg.installed:</div><div class="line">    - names: </div><div class="line">      - httpd</div><div class="line">      - httpd-devel</div><div class="line">  service.running:</div><div class="line">    - name: httpd</div><div class="line">    - <span class="built_in">enable</span>: True</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/27.png?raw=true" alt="27"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;说明，apache-service是id的名字，自定义的。pkg.installed 为包安装函数，下面是要安装的包的名字。service.running也是一个函数，来保证指定的服务启动，enable表示开机启动。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;执行： salt ‘web10.yanyi.com’ state.highstate</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/28.png?raw=true" alt="28"></p>
<h2 id="5-配置文件和目录管理"><a href="#5-配置文件和目录管理" class="headerlink" title="5.配置文件和目录管理"></a>5.配置文件和目录管理</h2><h3 id="配置管理文件"><a href="#配置管理文件" class="headerlink" title="配置管理文件"></a>配置管理文件</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/filetest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">file_test:</div><div class="line">  file.managed:</div><div class="line">    - name: /tmp/yanyi.com</div><div class="line">    - <span class="built_in">source</span>: salt://<span class="built_in">test</span>/123/1.txt</div><div class="line">    - user: root</div><div class="line">    - group: root</div><div class="line">    - mode: 644</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/29.png?raw=true" alt="29"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;说明：第一行的file_test为自定的名字，表示该配置段的名字，可以在别的配置段中引用它，source指定文件从哪里拷贝，这里的test相当于是/srv/salt/test</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># mkdir /srv/salt/test</span></div><div class="line">[root@web9 ~]<span class="comment"># mkdir /srv/salt/test/123</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;更改 top.sls </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/30.png?raw=true" alt="30"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/31.png?raw=true" alt="31"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;客户端查看</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/32.png?raw=true" alt="32"></p>
<h3 id="配置管理目录"><a href="#配置管理目录" class="headerlink" title="配置管理目录"></a>配置管理目录</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/dirtest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容    </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">file_dir:</div><div class="line">  file.recurse:</div><div class="line">    - name: /tmp/testdir</div><div class="line">    - <span class="built_in">source</span>: salt://<span class="built_in">test</span>/123</div><div class="line">    - user: root</div><div class="line">    - file_mode: 644</div><div class="line">    - dir_mode: 755</div><div class="line">    - mkdir: True</div><div class="line">    - clean: True</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/33.png?raw=true" alt="33"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>clean: True</strong> 加上它之后，源删除文件或目录，目标也会跟着删除，否则不会删除</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;参考  <a href="http://www.0550go.com/automation-deployment/saltstack/saltstack-file-recurse.html" target="_blank" rel="external">http://www.0550go.com/automation-deployment/saltstack/saltstack-file-recurse.html</a></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 top.sls</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/34.png?raw=true" alt="34"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/35.png?raw=true" alt="35"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;查看客户端</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/36.png?raw=true" alt="36"></p>
<h2 id="6-配置管理远程命令"><a href="#6-配置管理远程命令" class="headerlink" title="6.配置管理远程命令"></a>6.配置管理远程命令</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/cmdtest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">cmd_test:</div><div class="line">  cmd.run:</div><div class="line">    - onlyif: <span class="built_in">test</span> -f /tmp/111.txt</div><div class="line">    - names:</div><div class="line">      - touch /tmp/111.txt</div><div class="line">      - mkdir /tmp/1233</div><div class="line">    - user: root</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/37.png?raw=true" alt="37"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;还可以加unless，和onlyif正好相反</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 top.sls</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/38.png?raw=true" alt="38"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/39.png?raw=true" alt="39"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;查看客户端</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/40.png?raw=true" alt="40"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重新修改配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/cmdtest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">cmd_test:</div><div class="line">  cmd.run:</div><div class="line">    - unless: <span class="built_in">test</span> -f /tmp/111.txt</div><div class="line">    - names:</div><div class="line">      - touch /tmp/111.txt</div><div class="line">      - mkdir /tmp/1233</div><div class="line">    - user: root</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/41.png?raw=true" alt="41"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/42.png?raw=true" alt="42"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;查看客户端</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/43.png?raw=true" alt="43"></p>
<h2 id="7-配置管理远程脚本"><a href="#7-配置管理远程脚本" class="headerlink" title="7.配置管理远程脚本"></a>7.配置管理远程脚本</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/shelltest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">shell_test:</div><div class="line">  cmd.script:</div><div class="line">    - <span class="built_in">source</span>: salt://<span class="built_in">test</span>/1.sh</div><div class="line">    - user: root</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/44.png?raw=true" alt="44"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑脚本文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/test/1.sh</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="meta">#!/bin/bash</span></div><div class="line">touch /tmp/111.txt</div><div class="line"><span class="keyword">if</span> [ -d /tmp/1233 ]</div><div class="line"><span class="keyword">then</span></div><div class="line">    rm -rf /tmp/1233</div><div class="line"><span class="keyword">else</span></div><div class="line">    mkdir /tmp/1233</div><div class="line"><span class="keyword">fi</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/45.png?raw=true" alt="45"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 top.sls</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/46.png?raw=true" alt="46"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/47.png?raw=true" alt="47"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;客户端查看</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/48.png?raw=true" alt="48"></p>
<h2 id="8-配置管理任务计划"><a href="#8-配置管理任务计划" class="headerlink" title="8.配置管理任务计划"></a>8.配置管理任务计划</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/crontest.sls</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">cron_test:</div><div class="line">  cron.present:</div><div class="line">    - name: /bin/touch /tmp/111.txt</div><div class="line">    - user: root</div><div class="line">    - minute: <span class="string">'*'</span></div><div class="line">    - hour: 20</div><div class="line">    - daymonth: <span class="string">'*'</span></div><div class="line">    - month: <span class="string">'*'</span></div><div class="line">    - dayweek: <span class="string">'*'</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/49.png?raw=true" alt="49"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;注意，*需要用单引号引起来。当然我们还可以使用file.managed模块来管理cron，因为系统的cron都是以配置文件的形式存在的。想要删除该cron，需要增加：<br>cron.absent:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;- name: /bin/touch /tmp/111.txt</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;两者不能共存，要想删除一个cron，那之前的present就得去掉。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑 top.sls</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># vim /srv/salt/top.sls</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/50.png?raw=true" alt="50"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;服务端刷新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' state.highstate</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/51.png?raw=true" alt="51"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;客户端查看</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/52.png?raw=true" alt="52"></p>
<h2 id="9-saltstack-几个常用的命令"><a href="#9-saltstack-几个常用的命令" class="headerlink" title="9.saltstack 几个常用的命令"></a>9.saltstack 几个常用的命令</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cp.get_file  拷贝master上的文件到客户端</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' cp.get_file salt://apache.sls /tmp/yanyi.com</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/53.png?raw=true" alt="53"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cp.get_dir 拷贝目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@web9 ~]<span class="comment"># salt 'web10.yanyi.com' cp.get_dir salt://test /tmp/yanyi</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/54.png?raw=true" alt="54"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;会自动在客户端创建test目录，所以后面不要加test，如果写成 /tmp/yanyi/  则会在/tmp/yanyi/目录下又创建test</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt-run manage.up  显示存活的minion</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/55.png?raw=true" alt="55"></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;salt ‘*’ cmd.script salt://test/1.sh  命令行下执行master上的shell脚本</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/Saltstack%20%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/56.png?raw=true" alt="56"></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Saltstack/" rel="tag"># Saltstack</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/Redis/9. Redis基本操作——String/" rel="next" title="Redis基本操作——String">
                <i class="fa fa-chevron-left"></i> Redis基本操作——String
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/Samba/1. samba部署和优化/" rel="prev" title="samba部署和优化">
                samba部署和优化 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-saltstack安装"><span class="nav-number">1.</span> <span class="nav-text">1.saltstack安装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#启动服务"><span class="nav-number">1.1.</span> <span class="nav-text">启动服务</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置认证"><span class="nav-number">1.2.</span> <span class="nav-text">配置认证</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#远程执行命令"><span class="nav-number">1.3.</span> <span class="nav-text">远程执行命令</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-saltstack-grains"><span class="nav-number">2.</span> <span class="nav-text">2.saltstack grains</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#自定义-grains"><span class="nav-number">2.1.</span> <span class="nav-text">自定义 grains</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-saltstack-pillar"><span class="nav-number">3.</span> <span class="nav-text">3.saltstack pillar</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-配置管理安装-apache"><span class="nav-number">4.</span> <span class="nav-text">4.配置管理安装 apache</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-配置文件和目录管理"><span class="nav-number">5.</span> <span class="nav-text">5.配置文件和目录管理</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#配置管理文件"><span class="nav-number">5.1.</span> <span class="nav-text">配置管理文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置管理目录"><span class="nav-number">5.2.</span> <span class="nav-text">配置管理目录</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-配置管理远程命令"><span class="nav-number">6.</span> <span class="nav-text">6.配置管理远程命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-配置管理远程脚本"><span class="nav-number">7.</span> <span class="nav-text">7.配置管理远程脚本</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-配置管理任务计划"><span class="nav-number">8.</span> <span class="nav-text">8.配置管理任务计划</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#9-saltstack-几个常用的命令"><span class="nav-number">9.</span> <span class="nav-text">9.saltstack 几个常用的命令</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
